package day04;

import java.util.Scanner;

public class practice {
    public static void main(String[] args) {
        /*
        //接收用户输入的一个整数num，判断它的正负零值，正数则输出"+"，负数则输出"-"，0则输出"0"
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入一个整数");
        int num = scan.nextInt();
        if(num>0){
            System.out.println("+");
        } else if (num<0) {
            System.out.println("-");
        }else{
            System.out.println(0);
        }

         */

        /*
        //接收用户输入的年份year和月份month，计算该年该月的天数，并输出
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入年份");
        int years = scan.nextInt();
        System.out.println("请输入月份");
        int month = scan.nextInt();
        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                System.out.println("31天");
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                System.out.println("30天");
                break;
            case 2:
                if (years%400==0 || (years%4==0 && years%100!=0)){
                    System.out.println("29天");
                }else{
                    System.out.println("28天");
                }
        }

         */

//         输出1900到2023年之间所有的闰年(每够10个年份，换一行)
        /*
        int years,count=0;
        for(years=1900;years<=2023;years++){
            if (years%400==0 || (years%4==0 && years%100!=0)){
                System.out.print(years+" ");
                count++;
            }
            if(count%10==0){
                System.out.println();
            }
        }

         */
        /*
        //输入一个日期，判断它是本年的第几天
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入年份");
        int years = scan.nextInt();
        System.out.println("请输入一个月份");
        int month = scan.nextInt();
        while (month>12 || month<=0){
            System.out.println("输入错误");
            month = scan.nextInt();
        }
        System.out.println("请输入天数");
        int day = scan.nextInt();

        switch (month){
            case 12:
                while (day>31 || day<=0){
                    System.out.println("输入错误");
                    day = scan.nextInt();
                }
                break;
            case 11:
                while (day>30 || day<=0){
                    System.out.println("输入错误");
                    day = scan.nextInt();
                }
                break;
            case 10:
                while (day>31 || day<=0){
                    System.out.println("输入错误");
                    day = scan.nextInt();
                }
                break;
            case 9:
                while (day>30 || day<=0){
                    System.out.println("输入错误");
                    day = scan.nextInt();
                }
                break;
            case 8:
                while (day>31 || day<=0){
                    System.out.println("输入错误");
                    day = scan.nextInt();
                }
                break;
            case 7:
                while (day>31 || day<=0){
                    System.out.println("输入错误");
                    day = scan.nextInt();
                }
                break;
            case 6:
                while (day>30 || day<=0){
                    System.out.println("输入错误");
                    day = scan.nextInt();
                }
                break;
            case 5:
                while (day>31 || day<=0){
                    System.out.println("输入错误");
                    day = scan.nextInt();
                }
                break;
            case 4:
                while (day>30 || day<=0){
                    System.out.println("输入错误");
                    day = scan.nextInt();
                }
                break;
            case 3:
                while (day>31 || day<=0){
                    System.out.println("输入错误");
                    day = scan.nextInt();
                }
                break;
            case 2:
                if (years%400==0 || (years%4==0 && years%100!=0)){
                    while (day>29 || day<=0){
                        System.out.println("输入错误");
                        day = scan.nextInt();
                    }
                }else {
                    while (day>28 || day<=0){
                        System.out.println("输入错误");
                        day = scan.nextInt();
                    }
                }
                break;
            case 1:
                if (day>31 || day<=0){
                    System.out.println("输入错误");
                }
        }
        switch (month-1){
            case 12:
                day +=31;
            case 11:
                day +=30;
            case 10:
                day +=31;
            case 9:
                day +=30;
            case 8:
                day +=31;
            case 7:
                day +=31;
            case 6:
                day +=30;
            case 5:
                day +=31;
            case 4:
                day +=30;
            case 3:
                day +=31;
            case 2:
                if (years%400==0 || (years%4==0 && years%100!=0)){
                    day +=29;
                }else {
                    day +=28;
                }
            case 1:
                day +=31;
        }
        System.out.println("他是本年的第"+day+"天");

         */

        //菱形
        for(int i=1;i<=9;i+=2){

            for (int k=4;k>=(i+1)/2;k--){
                    System.out.print(" ");
            }
            for (int j=1;j<=i;j++){
                System.out.print("*");
            }
            System.out.println();
        }
        for(int i=1;i<=7;i+=2){
            for(int k=1;k<=(i+1)/2;k++){
                System.out.print(" ");
            }
            for (int j=7;j>=i;j--){
                System.out.print("*");
            }
            System.out.println();
        }














    }
}
